import { createWebHistory, createRouter } from 'vue-router'
import { setUpPermission } from './permission'

import layout from '../layout.vue'

const routes = [
    { path: '/', component: layout, redirect: '/dashbound',
        children: [
            { path: '/dashbound', component: () => import("@/views/home/index.vue") },
        ]
     },
    { path: '/login', component: () => import("@/views/login/index.vue"), meta: { isPublic: true } },
    { path: '/test', component: () => import("@/views/test/index.vue"), meta: { isPublic: true } },
    { path: '/:pathMatch(.*)*', name: 'NotFound', component: () => import('@/views/error/404.vue'), meta: { isPublic: true } },
]

const router = createRouter({
    history: createWebHistory(),
    routes,
})

setUpPermission(router)

export default router